package org.compiere.process;

import java.io.File;
import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;

import jxl.Workbook;
import jxl.format.Alignment;
import jxl.format.Border;
import jxl.format.BorderLineStyle;
import jxl.format.CellFormat;
import jxl.format.Colour;
import jxl.format.VerticalAlignment;
import jxl.write.Label;
import jxl.write.Number;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;

import org.adempiere.exceptions.AdempiereException;
import org.compiere.apps.ADialog;
import org.compiere.model.MAttachmentEntry;
import org.compiere.model.MBPartner;
import org.compiere.model.MhrmvacationscheduleLine;
import org.compiere.model.X_hrm_absence;
import org.compiere.model.X_hrm_years;
import org.compiere.util.DB;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.eevolution.model.X_HR_Employee;
import org.eevolution.model.X_HR_Job;
import org.joda.time.DateTime;

import extend.org.compiere.hrm.ExcelCell;
import extend.org.compiere.utils.Util;

public class VacationSchedulePrint extends SvrProcess {

	/** Current context		*/
	private Properties m_ctx;
	/**	 */
	private ProcessInfo pi;
	/** */
	private BigDecimal HR_Department_ID = new BigDecimal(0);
	/** */
	private BigDecimal HR_Block_ID = new BigDecimal(0);
	/** */	
	private BigDecimal hrm_years_ID = new BigDecimal(0);
	/** */
	private MhrmvacationscheduleLine[] hrmVaLine = null;
	/** */
	private ListVacation[] lines = null;
	/** */
	private X_hrm_years year = null;
	/** */
	private String path = "";
	/***/
	private boolean open = false;
	/** */
	private String performance = "N";
	/** */
	private DateTime dtSPerfomance;
	private DateTime dtEPerfomance;
	
	
	@Override
	protected void prepare() {
		
		log.info("");
		m_ctx = Env.getCtx();
		pi = getProcessInfo();
		
		ProcessInfoParameter[] para = getParameter();
		for (int i = 0; i < para.length; i++)	{
			String name = para[i].getParameterName();
			if (name == null); 
				//
			else if (name.compareTo("HR_Department_ID") == 0 && para[i].getParameter() != null)
				HR_Department_ID = (BigDecimal) para[i].getParameter();
			else if (name.compareTo("HR_Block_ID") == 0 && para[i].getParameter() != null)
				HR_Block_ID = (BigDecimal) para[i].getParameter();
			else if (name.compareTo("hrm_years_ID") == 0)
				hrm_years_ID = (BigDecimal) para[i].getParameter();
			else if (name.compareTo("report") == 0)
				performance = (String) para[i].getParameter();
			else if (name.toLowerCase().endsWith("directory"))
				path = (String)para[i].getParameter();
			else
			{
				log.log(Level.INFO, "Unknown Parameter: " + name);
			}
		}
		
		//
		year = new X_hrm_years(m_ctx, hrm_years_ID.intValue(), null);
		if(path.isEmpty()){
			path = Util.localFilePath;
			open = true;
		}else
			path = path + System.getProperty("file.separator");
		
	}

	@Override
	protected String doIt() throws Exception {
		
		// Types of cells for
		Label label;
		Number number;
		// There are checks for a specified pattern
		String templateName = "SampleVacationSchedule";
		
		//
		MAttachmentEntry entry = Util.getAttachment(pi, m_ctx, templateName);
		if(entry == null)
			throw new AdempiereException(Msg.translate(m_ctx, "NotFoundTemplate")+" "+templateName);
		
		// We define a path to generate
		String fileExtension = entry.getName().substring(entry.getName().lastIndexOf("."),entry.getName().length());
		StringBuffer fullPath = new StringBuffer(path); 
		if(!open)
			if(performance.equals("N"))
				fullPath.append("Vacation schedule").append(year.getName());
			else
				fullPath.append("Vacation schedule Performance").append(year.getName());
		else
			fullPath.append("Temporary VacationSchedule");
		
		fullPath.append(fileExtension);
		
		// 
        File templateCopy = new File(fullPath.toString());
        File temporaryFile = entry.getFile(Util.localFilePath+templateName);
		Workbook tableBook = null;
		WritableWorkbook copy = null;
		WritableSheet sheet = null;
		 try {
			 tableBook = Workbook.getWorkbook(temporaryFile);
			 copy = Workbook.createWorkbook(templateCopy, tableBook);
			 sheet = copy.getSheet(0);
        } catch (Exception e) {
        	ADialog.error(999, null, "Error tableBook. " + e.getMessage());
        	return "Error tableBook.";
        }

       ExcelCell cellStart =  Util.getCellStart(tableBook,">>");

       // Standart style cell
       WritableCellFormat borderStyle = new WritableCellFormat();
       borderStyle.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK);
       borderStyle.setAlignment(Alignment.CENTRE);
       borderStyle.setVerticalAlignment(VerticalAlignment.CENTRE);
       borderStyle.setWrap(true);
       // Vacation Plan style cell
       WritableFont fontHoliday = new WritableFont (WritableFont.TIMES, 8, WritableFont.BOLD);
       WritableCellFormat cellHoliday = new WritableCellFormat(fontHoliday);
       cellHoliday.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK);
       cellHoliday.setAlignment(Alignment.CENTRE);
       cellHoliday.setVerticalAlignment(VerticalAlignment.CENTRE);
       cellHoliday.setBackground(Colour.GRAY_25);
       // Vacation Fact style cell
       WritableCellFormat cellImposition = new WritableCellFormat();
       cellImposition.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK);
       cellImposition.setAlignment(Alignment.CENTRE);
       cellImposition.setVerticalAlignment(VerticalAlignment.CENTRE);
       cellImposition.setBackground(Colour.GREEN);
       // Vacation Fact style cell
       WritableCellFormat cellHolidayF = new WritableCellFormat(fontHoliday);
       cellHolidayF.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK);
       cellHolidayF.setAlignment(Alignment.CENTRE);
       cellHolidayF.setVerticalAlignment(VerticalAlignment.CENTRE);
       cellHolidayF.setBackground(Colour.TAN);
       // Title style cell
       WritableFont fontTitle = new WritableFont (WritableFont.TIMES, 14, WritableFont.BOLD);
       WritableCellFormat titleStyle = new WritableCellFormat(fontTitle);
       titleStyle.setAlignment(Alignment.CENTRE);
       titleStyle.setVerticalAlignment(VerticalAlignment.CENTRE);
       // Department style cell
       WritableFont fontDepartment = new WritableFont (WritableFont.TIMES, 12, WritableFont.BOLD);
       WritableCellFormat cellDepartment = new WritableCellFormat(fontDepartment);
       cellDepartment.setBorder(Border.ALL, BorderLineStyle.THIN, Colour.BLACK);
       cellDepartment.setAlignment(Alignment.CENTRE);
       cellDepartment.setVerticalAlignment(VerticalAlignment.CENTRE);
       cellDepartment.setBackground(Colour.TAN);
       
       Object[] param = new Object[]{year.getName()};
       if(performance.equals("N"))
    	   label = new Label(1, 4, sheet.getCell(1, 4).getContents()+MessageFormat.format(" на {0} год", param), titleStyle);
       else
    	   label = new Label(1, 4, "Исполнение графиков отпусков сотрудников"+MessageFormat.format(" на {0} год", param), titleStyle);
       sheet.addCell(label);
   	   label = new Label(1, 5, Env.getContext(getCtx(), "#AD_Org_Name"), titleStyle);
       sheet.addCell(label);
       
       //
       sheet.setColumnView(2, 40);
      
       lines = getListVacation();
       X_HR_Employee he = null;
       MBPartner bp = null;
       // the period of leave
       DateTime dtS;
       DateTime dtE;
       int col = cellStart.getC()+3; // offset by the number of first columns
       int row = cellStart.getR();
       int flag = row-2;
       int num = 1;
       int tt = 0;
       int dId = 0; // Departmnet ID Merge cells
       int dep = 0;
       for(int k = row; k < (row+lines.length); k++){
    	   
    	   // Title
	       he = X_HR_Employee.getHR_Employee(lines[tt].getBpartner_id(),true); 
	       X_HR_Job job = new X_HR_Job(getCtx(), he.getHR_Job_ID(), null);
	       bp = new MBPartner(getCtx(),lines[tt].getBpartner_id(),null);
    	   
    	   if(dId != he.getHR_Department_ID()){
				dId = he.getHR_Department_ID();
				sheet.mergeCells(1, k+dep, 28, k+dep);
				sheet.setRowView(k+dep, 500);
				label = new Label(1, k+dep, he.getHR_Department().getName(), cellDepartment); 
				sheet.addCell(label);
				dep++;
			}   
    	   
    	   //
    	   hrmVaLine = MhrmvacationscheduleLine.getLines(HR_Department_ID.intValue(), hrm_years_ID.intValue(), lines[tt].getBpartner_id());
    	   sheet.setRowView(k+dep, 700);	       
	       
	       // №
		   number = new Number(cellStart.getC(), k+dep, num, borderStyle); 
	       sheet.addCell(number);
	       // Initials
	       if(bp.getFirstName() != null && bp.getLastName() != null)
	    	   label = new Label(cellStart.getC()+1, k+dep, bp.getLastName()+" "+bp.getFirstName()+" "+bp.getMiddleName(), borderStyle); 
	       else
	    	   label = new Label(cellStart.getC()+1, k+dep, bp.getName(), borderStyle);
	       sheet.addCell(label);
	       // Job
		   label = new Label(cellStart.getC()+2, k+dep, job.getName(), borderStyle); 
	       sheet.addCell(label);
	       job = null;
    	   
    	   int n = 0;
	       for(int j = 0; j < (hrmVaLine.length); j++){
	    	   
		       int t = 1;
		       int inc=col;
		       dtS = null;
		       dtE = null;
	    	   for(int i = col; i <= (24+col-1); i++){

	    		   if(hrmVaLine[n].getStartDate() != null)
	    			   dtS = new DateTime(hrmVaLine[n].getStartDate().getTime());
	    		   if(hrmVaLine[n].getEndDate() != null)
	    			   dtE = new DateTime(hrmVaLine[n].getEndDate().getTime());
	    		   int startPosition = 0;
	    		   int endPosition = 0;
	    		   // 
	    		   if(dtS != null){
	    			   startPosition = dtS.getMonthOfYear()*2;
	    			   if(dtS.getDayOfMonth() < 15)
	    				   --startPosition;
	    		   }
	    		   // 
	    		   if(dtE != null){
	    			   endPosition = dtE.getMonthOfYear()*2;
	    			   if(dtE.getDayOfMonth() < 15)
	    				   --endPosition;
	    		   }
	
	    		   if(t >= startPosition && t <= endPosition){
					if(t == startPosition){
						label = new Label(i, k+dep, String.valueOf(dtS.getDayOfMonth()), cellHoliday);
	    				   if(startPosition == endPosition)
	    					   label = new Label(i, k+dep, sheet.getCell(i, k+dep).getContents()+" "+ String.valueOf(dtS.getDayOfMonth()+"-"+dtE.getDayOfMonth()), cellHoliday);
	    			   }
	    			   else if(t == endPosition)
	    				   label = new Label(i, k+dep, sheet.getCell(i, k+dep).getContents()+" "+ String.valueOf(dtE.getDayOfMonth()), cellHoliday);
	    			   else
	    				   label = new Label(i, k+dep, sheet.getCell(i, k+dep).getContents()+"-" , cellHoliday);
	    		   } else
	    			   if(n == 0)
	    				   label = new Label(i, k+dep, sheet.getCell(i, k+dep).getContents() , borderStyle);
	    			   else
	    				   label = new Label(i, k+dep, sheet.getCell(i, k+dep).getContents() , sheet.getWritableCell(i, k+dep).getCellFormat());
	    		   
	    		   sheet.addCell(label);
	    	       
	    	       t++;
	    	       inc++;
	    	   }
	    	   
	    	   // Signed and Description
	    	   label = new Label(inc, k+dep, "", borderStyle);
	    	   sheet.addCell(label);
	    	   
		    	// shift the basement
			    sheet.insertRow(k+dep+1);
	    	   
	    	   n++;
	       	}
	       
	       if(performance.equals("Y")){
	    	   
	    	   X_hrm_years year = new X_hrm_years(getCtx(), hrm_years_ID.intValue(), get_TrxName()); 
	    	   ListDate[] linesDate =  getListDate(lines[tt].getBpartner_id(), year.getName());
	    	   
	    	   int e = 0;
	    	   for(int f = 0; f < linesDate.length; f++){
	    		   
	    		   if(linesDate[f].getsDate() != null)
		    		   dtSPerfomance = new DateTime(linesDate[f].getsDate().getTime());
	    		   if(linesDate[f].geteDate() != null)
	    			   dtEPerfomance = new DateTime(linesDate[f].geteDate().getTime());
	    		   int sPosition = 0;
	    		   int ePosition = 0;
	    		   // 
	    		   if(dtSPerfomance != null){
	    			   sPosition = dtSPerfomance.getMonthOfYear()*2;
	    			   if(dtSPerfomance.getDayOfMonth() < 15)
	    				   --sPosition;
	    		   }
	    		   // 
	    		   if(dtEPerfomance != null){
	    			   ePosition = dtEPerfomance.getMonthOfYear()*2;
	    			   if(dtEPerfomance.getDayOfMonth() < 15)
	    				   --ePosition;
	    		   }
	    		   
	    		   int r = 1;
			       for(int i = col; i <= (24+col-1); i++){
			    	   
	    			   CellFormat rr = null;
	    			   Colour ee = null;
	  				   rr = sheet.getCell(i, k+dep).getCellFormat();
	  				   if(rr != null)
		  				   ee = rr.getBackgroundColour();
			    	   
		    		   if(r >= sPosition && r <= ePosition){
		    			   if(r == sPosition){
		    				   if(e == 0){
		    					   if(ee != null && ee.equals(Colour.GRAY_25))
		    						   label = new Label(i, k+dep, String.valueOf(dtSPerfomance.getDayOfMonth()), cellImposition);
		    					   else
		    						   label = new Label(i, k+dep, String.valueOf(dtSPerfomance.getDayOfMonth()), cellHolidayF);
		    				   }
		    				   else{
		    					   if(ee != null && ee.equals(Colour.GRAY_25))
		    						   label = new Label(i, k+dep, String.valueOf(dtSPerfomance.getDayOfMonth()), cellImposition);
		    					   else
		    						   label = new Label(i, k+dep, String.valueOf(dtSPerfomance.getDayOfMonth()), sheet.getWritableCell(i, k+dep).getCellFormat());
		    				   }
		    				   if(sPosition == ePosition)
		    					   if(e == 0){
		    						   if(ee != null && ee.equals(Colour.GRAY_25))
		    							   label = new Label(i, k+dep, String.valueOf(dtSPerfomance.getDayOfMonth()+"-"+dtEPerfomance.getDayOfMonth()), cellImposition);
		    						   else
		    							   label = new Label(i, k+dep, sheet.getCell(i, k+dep).getContents()+" "+ String.valueOf(dtSPerfomance.getDayOfMonth()+"-"+dtEPerfomance.getDayOfMonth()), cellHolidayF);
		    					   }
		    					   else{
		    						   if(ee != null && ee.equals(Colour.GRAY_25))
		    							   label = new Label(i, k+dep, String.valueOf(dtSPerfomance.getDayOfMonth()+"-"+dtEPerfomance.getDayOfMonth()), cellImposition);
		    						   else
		    							   label = new Label(i, k+dep, sheet.getCell(i, k+dep).getContents()+" "+ String.valueOf(dtSPerfomance.getDayOfMonth()+"-"+dtEPerfomance.getDayOfMonth()), sheet.getWritableCell(i, k+dep).getCellFormat());
		    					   }
		    			   }
		    			   else if(r == ePosition){
		    				   if(e == 0){
		    					   if(ee != null && ee.equals(Colour.GRAY_25))
		    						   label = new Label(i, k+dep, String.valueOf(dtEPerfomance.getDayOfMonth()), cellImposition);
		    					   else
		    						   label = new Label(i, k+dep, sheet.getCell(i, k+dep).getContents()+" "+ String.valueOf(dtEPerfomance.getDayOfMonth()), cellHolidayF);
		    				   }
		    				   else{
		    					   if(ee != null && ee.equals(Colour.GRAY_25))
		    						   label = new Label(i, k+dep, String.valueOf(dtEPerfomance.getDayOfMonth()), cellImposition);
		    					   else
		    						   label = new Label(i, k+dep, sheet.getCell(i, k+dep).getContents()+" "+ String.valueOf(dtEPerfomance.getDayOfMonth()), sheet.getWritableCell(i, k+dep).getCellFormat());
		    				   }
		    			   }
		    			   else{
		    				   if(e == 0){
		    					   if(ee != null && ee.equals(Colour.GRAY_25))
		    						   label = new Label(i, k+dep, sheet.getCell(i, k+dep).getContents()+"-" , cellImposition);
		    					   else
		    						   label = new Label(i, k+dep, sheet.getCell(i, k+dep).getContents()+"-" , cellHolidayF);
		    				   }
		    				   else{
		    					   if(ee != null && ee.equals(Colour.GRAY_25))
		    						   label = new Label(i, k+dep, sheet.getCell(i, k+dep).getContents() , cellImposition);
		    					   else
		    						   label = new Label(i, k+dep, sheet.getCell(i, k+dep).getContents() , sheet.getWritableCell(i, k+dep).getCellFormat());
		    				   }
		    			   }
		    		   } else
	    				   label = new Label(i, k+dep, sheet.getCell(i, k+dep).getContents() , sheet.getWritableCell(i, k+dep).getCellFormat());
		    		   
		    		   sheet.addCell(label);

			    	   r++;
			       }
			       e++;
	    	   }
	       }	       
	       hrmVaLine = null;
	       flag = k+dep;
	       num++;
	       tt++;
       }
       
       if(performance.equals("Y")){
	       // Plan
	       label = new Label(4, flag+2, "", cellHoliday);
	       sheet.addCell(label);
	       sheet.mergeCells(6, flag+2, 8, flag+2);
	       label = new Label(6, flag+2, "план");
	       sheet.addCell(label);
	       // Fact
	       label = new Label(10, flag+2, "", cellHolidayF);
	       sheet.addCell(label);
	       sheet.mergeCells(12, flag+2, 14, flag+2);
	       label = new Label(12, flag+2, "факт");
	       sheet.addCell(label);
	       // Imposition
	       label = new Label(16, flag+2, "", cellImposition);
	       sheet.addCell(label);
	       sheet.mergeCells(18, flag+2, 20, flag+2);
	       label = new Label(18, flag+2, "совпадение");
	       
	       sheet.addCell(label);
       }
		
       copy.write();
       copy.close();
       tableBook.close();
       temporaryFile.delete();
       
       // Open the file with the application associated
       String fileName = fullPath.toString();
       Util.launchFile(new File(fileName));
		
       return Msg.translate(m_ctx, "Success");
	}
	
	private ListVacation[] getListVacation(){
		
		ListVacation values = null;
		List<ListVacation> list = new ArrayList<ListVacation>();
		PreparedStatement pstmt = null;
		ResultSet rs = null;		
		
		List<Object> param = new ArrayList<Object>();
		param.add(Env.getAD_Client_ID(Env.getCtx()));		
		param.add(hrm_years_ID);
		
		String sql = "SELECT T.C_BPARTNER_ID, R.HRM_YEARS_ID, AD_TREENODEDEP.PARENT_ID, AD_TREENODEDEP.SEQNO FROM HRM_VACATIONSCHEDULELINE T \n"+
					 "JOIN HRM_VACATIONSCHEDULE R ON R.HRM_VACATIONSCHEDULE_ID=T.HRM_VACATIONSCHEDULE_ID \n" +
					 "JOIN HR_EMPLOYEE TT ON TT.C_BPARTNER_ID=T.C_BPARTNER_ID " +
					 "				AND TT.ENDDATE = (SELECT MAX(H.ENDDATE) FROM HR_EMPLOYEE H WHERE H.C_BPARTNER_ID=TT.C_BPARTNER_ID) \n" +
					 "LEFT JOIN AD_TREENODEDEP ON AD_TREENODEDEP.NODE_ID=TT.HR_DEPARTMENT_ID \n"+ 
					 "WHERE T.ISACTIVE='Y' \n"+ 
					 "AND T.AD_CLIENT_ID=? \n"+ 
					 "AND R.HRM_YEARS_ID=? \n";
					
		if(HR_Department_ID.intValue() != 0){
			sql += " AND R.HR_DEPARTMENT_ID=? \n";
			param.add(HR_Department_ID);
		}
		else if(HR_Block_ID.intValue() != 0){
			sql += " AND R.HR_DEPARTMENT_ID IN (SELECT NODE_ID FROM AD_TREENODEDEP WHERE PARENT_ID=?) \n";
			param.add(HR_Block_ID);
		}
		
		sql += "GROUP BY T.C_BPARTNER_ID, R.HRM_YEARS_ID, AD_TREENODEDEP.PARENT_ID, AD_TREENODEDEP.SEQNO \n" +
			   "ORDER BY AD_TREENODEDEP.PARENT_ID ASC, AD_TREENODEDEP.SEQNO, T.C_BPARTNER_ID";
		
		try
		{
			pstmt = DB.prepareStatement(sql,get_TrxName());
			DB.setParameters(pstmt, param);
			rs = pstmt.executeQuery();	
					
			while (rs.next ())
			{
				values = new ListVacation();
				values.setBpartner_id(rs.getInt(1));
				values.setYears_ID(rs.getInt(2));
				values.setDepartment_ID(rs.getInt(3));
				list.add(values);
				values=null;
			}
		}
		catch (SQLException e)
		{
			log.log(Level.SEVERE, "product", e);
		}
		finally
		{
			DB.close(rs, pstmt);
			rs = null; pstmt = null;
		}	
		
		return list.toArray(new ListVacation[list.size()]);
	}
	
	private ListDate[] getListDate(int bpartner_id, String year){
		
		ListDate values = null;
		List<ListDate> list = new ArrayList<ListDate>();
		PreparedStatement pstmt = null;
		ResultSet rs = null;		
		
		String absenceType = "'"+X_hrm_absence.HRM_ABSENCETYPE_Vacation+"'";		// 1
		//absenceType += ",'"+X_hrm_absence.HRM_ABSENCETYPE_LeaveWithoutSalary+"'";	// 2
		//absenceType += ",'"+X_hrm_absence.HRM_ABSENCETYPE_EducationLeave+"'";		// 3
		
		String sql = "SELECT startdate, enddate \n" +
				"FROM hrm_absence \n" +
				"WHERE c_bpartner_id=? \n" +
				"AND hrm_absenceType IN ("+absenceType+") \n" +
				"AND TO_CHAR(startdate,'yyyy') = ? \n" +
				"GROUP BY startdate, enddate, c_bpartner_id";
		
		List<Object> param = new ArrayList<Object>();
		param.add(bpartner_id);
		param.add(year);
				
		try
		{
			pstmt = DB.prepareStatement(sql,get_TrxName());
			DB.setParameters(pstmt, param);
			rs = pstmt.executeQuery();	
					
			while (rs.next ())
			{
				values = new ListDate();
				values.setsDate(rs.getTimestamp(1));
				values.seteDate(rs.getTimestamp(2));
				list.add(values);
				values=null;
			}
		}
		catch (SQLException e)
		{
			log.log(Level.SEVERE, "product", e);
		}
		finally
		{
			DB.close(rs, pstmt);
			rs = null; pstmt = null;
		}	
		
		return list.toArray(new ListDate[list.size()]);
	}
	
	class ListVacation{
		
		private int department_ID;
		private int bpartner_id;
		private int years_ID;

		public int getDepartment_ID() {
			return department_ID;
		}
		public void setDepartment_ID(int department_ID) {
			this.department_ID = department_ID;
		}
		public int getBpartner_id() {
			return bpartner_id;
		}
		public void setBpartner_id(int bpartner_id) {
			this.bpartner_id = bpartner_id;
		}
		public int getYears_ID() {
			return years_ID;
		}
		public void setYears_ID(int years_ID) {
			this.years_ID = years_ID;
		}
		
	}
	
	class ListDate{
		
		private Timestamp sDate;
		private Timestamp eDate;
		public Timestamp getsDate() {
			return sDate;
		}
		public void setsDate(Timestamp sDate) {
			this.sDate = sDate;
		}
		public Timestamp geteDate() {
			return eDate;
		}
		public void seteDate(Timestamp eDate) {
			this.eDate = eDate;
		}
		
	}

}
